<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>积分记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/app/admin/component/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" media="all">
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">会员信息</label>
                            <div class="layui-input-inline">
                                <input type="text" name="keyword" placeholder="会员卡号/姓名/手机" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">变动类型</label>
                            <div class="layui-input-inline">
                                <select name="type">
                                    <option value="">全部类型</option>
                                    <option value="1">消费赠送</option>
                                    <option value="2">签到赠送</option>
                                    <option value="3">消费使用</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-points-search">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <table id="LAY-points-list" lay-filter="LAY-points-list"></table>
            </div>
        </div>
    </div>

    <script src="/app/admin/component/layui/layui.js"></script>
    <script src="/app/admin/component/pear/pear.js"></script>
    <script>
    layui.use(['table', 'form'], function(){
        var $ = layui.$
        ,table = layui.table
        ,form = layui.form;
        
        //积分记录列表
        table.render({
            elem: '#LAY-points-list'
            ,url: '/app/ky_shouyin/member/pointsList'
            ,cols: [[
                {field: 'id', title: 'ID', width: 80, sort: true}
                ,{field: 'member_name', title: '会员姓名', width: 100}
                ,{field: 'points', title: '积分变动', width: 100, templet: function(d){
                    return d.points > 0 ? '<span style="color:#5FB878;">+'+d.points+'</span>' : '<span style="color:#FF5722;">'+d.points+'</span>';
                }}
                ,{field: 'type', title: '变动类型', width: 100, templet: function(d){
                    var types = {1:'消费赠送', 2:'签到赠送', 3:'消费使用'};
                    return types[d.type] || '';
                }}
                ,{field: 'description', title: '变动说明'}
                ,{field: 'created_at', title: '变动时间', width: 160}
            ]]
            ,page: true
            ,limit: 15
            ,text: {
                none: '暂无数据'
            }
        });
        
        //监听搜索
        form.on('submit(LAY-points-search)', function(data){
            var field = data.field;
            
            //执行重载
            table.reload('LAY-points-list', {
                where: field
            });
        });
    });
    </script>
</body>
</html> 